{{ $context := .}}

<table class="table table-sm table-striped table-bordered">
    <tr><th>ID</th><th>Name</th><th>Address</th><th/></tr>
    <tbody>
        {{ range $context.Orders }}
            <tr>
                <td>{{ .ID }}</td>
                <td>{{ .Name }}</td>
                <td>{{ .StreetAddr }}, {{ .City }}, {{ .State }},
                     {{ .Country }}, {{ .Zip }}</td>
                <td>
                    <form method="POST" action="{{$context.CallbackUrl}}">
                        <input type="hidden" name="id" value="{{.ID}}" />
                        {{ if .Shipped }} 
                            <button class="btn-btn-sm btn-warning" type="submit">
                                Ship Order
                            </button>
                        {{ else }}
                            <button class="btn-btn-sm btn-danger" type="submit">
                                Mark Unshipped
                            </button>
                        {{ end }}
                    </form>
                </td>
            </tr>
            <tr><th colspan="2"/><th>Quantity</th><th>Product</th></tr>
            {{ range .Products }}
                <tr>
                    <td colspan="2"/>
                    <td>{{ .Quantity }}</td>
                    <td>{{ .Product.Name }}</td>
                </tr>
            {{ end }}
        {{ end }}
    </tbody>
</table>
